package com.ybzl.mini.controller;


import com.ybzl.common.annotation.Log;
import com.ybzl.common.core.controller.BaseController;
import com.ybzl.common.core.domain.Result;
import com.ybzl.common.enums.BusinessType;
import com.ybzl.mini.entity.MiniPyqImg;
import com.ybzl.mini.service.IMiniPyqImgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

/*
 * Desc：污友圈关联的图片信息
 * @Author xxx
 * @Company yb.com
 * @Since  2024-09-19
 *
 */
@Api(tags = "污友圈关联的图片信息")
@RestController
@RequestMapping("/miniPyqImg")
public class MiniPyqImgController extends BaseController {

    @Autowired
    private IMiniPyqImgService iMiniPyqImgService;

/**
 * 查询污友圈关联的图片信息
 *
 * @param miniPyqImg
 * @return
 */
/*@ApiOperation("查询污友圈关联的图片信息列表")
@Log(title = "污友圈关联的图片信息查询", businessType = BusinessType.OTHER)
@GetMapping("/v1/list")
public TableDataInfo list() {
startPage();
return getDataTable(iMiniPyqImgService.list());
}*/

    /**
     * 新增污友圈关联的图片信息
     *
     * @param miniPyqImg
     * @return
     */
    @Log(title = "新增污友圈关联的图片信息", businessType = BusinessType.INSERT)
    @ApiOperation("新增污友圈关联的图片信息")
    @PostMapping("/v1/add")
    public Result add(@Validated @RequestBody MiniPyqImg miniPyqImg) {
        return Result.success(iMiniPyqImgService.save(miniPyqImg));
    }

    /**
     * 修改污友圈关联的图片信息
     *
     * @param miniPyqImg
     * @return
     */

    @Log(title = "更新污友圈关联的图片信息", businessType = BusinessType.UPDATE)
    @ApiOperation("更新污友圈关联的图片信息")
    @PutMapping("/v1/update")
    public Result edit(@Validated @RequestBody MiniPyqImg miniPyqImg) {
        iMiniPyqImgService.updateById(miniPyqImg);
        return Result.success();
    }

    /**
     * 删除污友圈关联的图片信息
     *
     * @param ids
     * @return
     */
    @Log(title = "删除污友圈关联的图片信息", businessType = BusinessType.DELETE)
    @ApiOperation("删除污友圈关联的图片信息")
    @DeleteMapping("/v1/delete/{ids}")
    public Result remove(@PathVariable String ids) {
        iMiniPyqImgService.removeBatchByIds(Arrays.asList(ids.split(",")));
        return success();
    }
}
